
import request from "../utils/request";

export function fetchProductList(params) {
    return request({
        url: "product_list",
        method: "get",
        params: params
    })
}

export function fetchProductCateList(params){
    return request({
        url: "get_product_category_list/0",
        method: "get",
        params: params
    })
}

export function fetchBrandList(params){
    return request({
        url: "get_product_brand",
        method: "get",
        params: params
    })
}
export function fetchProductAttrList(params){
    return request({
        url: "get_product_attr",
        method: "get",
        params: params
    })
}

export function addProduct(data){
    return request({
        url: "create_product",
        method: "post",
        data: data
    })
}

export function fetchCateList(params) {
    return request({
        url: "get_product_category",
        method: "get",
        params: params
    })
}

export function addProductAttr(data) {
    return request({
        url: "create_product_attr",
        method: "post",
        data: data
    })
}
//通过 id 获取一条商品数据
export function fetchOneProduct(params) {
    return request({
        url: "product_one",
        method: "get",
        params: params
    })
}

//update_product
export function updateProduct(data) {
    return request({
        url: "update_product",
        method: "post",
        data: data
    })
}

//通过 自己的id 获取父级节点数据
export function fetchParentProductCate(params) {
    return request({
        url: "get_parent_id",
        method: "get",
        params: params
    })
}

export function deleteProduct(params) {
    return request({
        url: "delete_status",
        method: "get",
        params: params
    })
}

export function updateProductAttr(data,id) {
    return request({
        url: "update_product_attr/"+id,
        method: "post",
        data: data
    })
}


export function fetchProductCatePage(params, id) {
    return request({
        url: "get_product_category_list/" + id,
        method: "get",
        params: params
    })
}

//create_product_cate  添加 商品分类信息
export function addProductCate(data) {
    return request({
        url: "create_product_cate",
        method: "post",
        data: data
    })
}

export function addProductBrand(data) {
    return request({
        url: "create_product_brand",
        method: "post",
        data: data
    })
}

export function updateProductBrand(data) {
    return request({
        url: "update_product_brand",
        method: "post",
        data: data
    })
}
export function deleteBrand(params) {
    return request({
        url: "delete_product_brand",
        method: "get",
        params: params
    })
}

export function deleteProductAttr(params) {
    return request({
        url: "delete_product_attr",
        method: "get",
        params: params
    })
}

export function deleteProductCate(data) {
    return request({
        url: "delete_category",
        method: "post",
        data: data
    })
}









